package com.tanhua.model.vo;

import com.tanhua.model.domain.Admin;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;

/**
 * @author Xiao
 * @version 1.0
 * @description 管理员VO
 * @date 2021/11/3
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AdminVO implements Serializable {
    private String id;            //id
    private String username;    //用户名
    private String avatar;      //头像

    public static AdminVO init(Admin admin) {
        AdminVO adminVO = new AdminVO();
        BeanUtils.copyProperties(admin, adminVO);
        adminVO.setId(admin.getId().toString());
        return adminVO;
    }
}
